import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from '@/views/users/login.vue';
import Layout from '@/views/Layout.vue';

Vue.use(VueRouter);

const routes = [
  {
    path: '',
    redirect: '/login',
  },
  {
    path: '/',
    redirect: '/login',
  },
  {
    path: '/login',
    name: 'Login',
    component: Login,
  },
  {
    path: '/Layout',
    name: 'Layout',
    component: Layout,
    children: [
      {
        path: '/web',
        name: 'Web',
        component: () =>
          import(/* webpackChunkName: "web" */ '@/views/web/index.vue'),
      },
      {
        path: '/mobile',
        name: 'Mobile',
        component: () =>
          import(/* webpackChunkName: "mobile" */ '@/views/mobile/index.vue'),
      },
    ],
  },
];

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
